
using System.Collections.Generic;
using UnityEngine;
using Newtonsoft.Json;

public class DataMgr : Singleton<DataMgr>
{
    public Dictionary<int, Store> Store = new Dictionary<int, Store>();
    public Dictionary<int, Item> Item = new Dictionary<int, Item>();
    public Dictionary<int, Event> Event = new Dictionary<int, Event>();
    public void Init()
    {
        string StoreJson = Resources.Load<TextAsset>("Data/Json/Store").text;
        Store = JsonConvert.DeserializeObject<Dictionary<int, Store>>(StoreJson);
        string ItemJson = Resources.Load<TextAsset>("Data/Json/Item").text;
        Item = JsonConvert.DeserializeObject<Dictionary<int, Item>>(ItemJson);
        string EventJson = Resources.Load<TextAsset>("Data/Json/Event").text;
        Event = JsonConvert.DeserializeObject<Dictionary<int, Event>>(EventJson);
    }

}

public static class DM
{
    public static Dictionary<int, Item> Item => DataMgr.instance.Item;
    public static Dictionary<int, Store> Store => DataMgr.instance.Store;
    public static Dictionary<int, Event> Event => DataMgr.instance.Event;
}